import React, { Component, Suspense } from 'react';
import { connect } from 'dva';
import { Layout, Menu, Breadcrumb, Carousel, Row, Col, Icon, List, Typography } from 'antd';
import Slider from "react-slick";
// import Ellipsis from 'ant-design-pro/lib/Ellipsis';
// import 'ant-design-pro/dist/ant-design-pro.css';
import { JIANTOU2 } from '../../constants'
// import SliderItemList from '@/components/SliderItemList'
import KnowMore from '@/components/KnowMore'
import styles from './index.less';
import router from 'umi/router';
import SliderItemList from '@/components/SliderItemList'
import { apiDomainName } from '../../constants/index';

class SliderItem extends Component {
  state = {
  };

  componentDidMount() {
  }

  componentWillUnmount() {
  }

  pushToCollegeIntroduction = (id) => {
    console.log('id: ', id);
    let url = '';
    if (id === 1) {
      url = '/ipag/introduction';
    }
    else if (id === 2) {
      url = '/finland-central-university/introduction';
    }
    else if (id === 3) {
      url = '/paul-valery/introduction';
    }
    else if (id === 4) {
      url = '/lyon3/introduction';
    }
    // router.push(`${url}?collegeId=${id}`)
    // window.open(`${url}?collegeId=${id}`, '_blank')
    window.open(`http://home.himedu.cn/university/about-school?collegeId=${id}`, '_blank')
  }
  knowMore = (id) => {
    console.log('id: ', id);
    let url = '';
    if (id === 1) {
      url = '/ipag/information';
    }
    else if (id === 2) {
      url = '/finland-central-university/information';
    }
    else if (id === 3) {
      url = '/paul-valery/information';
    }
    else if (id === 4) {
      url = '/lyon3/information';
    }
    // router.push(`${url}?collegeId=${id}`)
    // window.open(`${url}?collegeId=${id}`, '_blank')
    window.open(`http://home.himedu.cn/university/information?collegeId=${id}`, '_blank')
  }

  onZixunClick = () => {
    // window.open('http://plt.zoosnet.net/LR/Chatpre.aspx?id=PLT70547676&lng=cn', '_blank')
    openJesongChatByGroup(13072,25026);return false;
    // window.open('https://tb.53kf.com/code/client/e87c220968f7fcbffe4a0165dd3e04c67/1', '_blank')
  }

  render() {
    const { imgSrc, content, listDataSource, id} = this.props;

    return (
      <div>
        <div style={{cursor: 'pointer', textAlign: 'center'}} onClick={this.onZixunClick}>
          <img style={{width: 150, height: 55}} src={'https://hua-jun-guan-wang.oss-cn-hangzhou.aliyuncs.com/%E9%A6%96%E9%A1%B5/dianjizixun.png'} />
        </div>
        <img
          onClick={()=>this.pushToCollegeIntroduction(id)}
          // style={{width:230, height:125, cursor: 'pointer'}}
          style={{width:'100%', height:150, cursor: 'pointer'}}
          src={imgSrc}
        />
        {/*<Ellipsis lines={3}>*/}
          <p
            style={{fontSize: 12, color: '#999999', marginTop: 10, cursor: 'pointer', height: 74, overflow: 'hidden'}}
            onClick={()=>this.pushToCollegeIntroduction(id)}
          >{content}</p>
        {/*</Ellipsis>*/}
        <SliderItemList dataSource={listDataSource} id={id}/>
        <div className={styles.knowMore}>
          <a onClick={() => this.knowMore(id)}>
            {/*<KnowMore icon={JIANTOU2} title={localStorage.getItem('umi_locale') == 'zh-CN'?'了解更多':'Know More'} />*/}
            <KnowMore icon={JIANTOU2} title={'了解更多'} />
          </a>
        </div>
      </div>
    );
  }
}

export default SliderItem;
